from App.util.response import ResponseUtils
from flask import jsonify


def not_found_error(e):
    fail_json = ResponseUtils.fail(404, str(e))
    return jsonify(fail_json), 404


def custom_exception(e):
    """
    出现自定义异常
    """
    fail_json = ResponseUtils.fail(e.code, e.msg)
    return jsonify(fail_json), e.code


def unknown_error(e):
    fail_json = ResponseUtils.fail(500, str(e))
    return jsonify(fail_json), 500
